UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'g0rmps7Ycqsx44EoG3pLd7Pi2TDWn3mELo2TMTzwcCk='
WHERE
key_id = '4fe93dc1a39a2a904f12ee0a7f9ea5653a5054669986c1523a41366b2b5da938'
AND (
token = 'g0rmps7Ycqsx44EoG3pLd7Pi2TDWn3mELo2TMTzwcCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)