UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N1dQE3kcC1jT+2eLI22H2kjSfhgi1cPLVzHB2UerAQg='
WHERE
key_id = 'd3cd518595c5cae8fdd39686ca1208ed776199b02d1192c3543a21d173ecf4ea'
AND (
token = 'N1dQE3kcC1jT+2eLI22H2kjSfhgi1cPLVzHB2UerAQg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)