UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ZqMhsbNotd8FsW3QBrFDOfagO3lW+r/vxlQtrfIc3w0='
WHERE
key_id = '8bf29c6f672fbc698c6bc8acc9265749bb5215a80301eefa64b2cee080bb435e'
AND (
token = 'ZqMhsbNotd8FsW3QBrFDOfagO3lW+r/vxlQtrfIc3w0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)