UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'trpSJdqHbjC9FwOoKnJNR6biLwVLTfbT3EiU+cWTRi4='
WHERE
key_id = '0d347044d23f624429b5bd6ff6c493cb38a698aa3fd1c05deedd51eb54940bdc'
AND (
token = 'trpSJdqHbjC9FwOoKnJNR6biLwVLTfbT3EiU+cWTRi4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)