UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DR9TwXWfTV3fAj5mAeBoTIOXpQNAH8U6soLZWgpSi7A='
WHERE
key_id = 'bd7a235ee8acd5952e0af7aa7c1d872da186ebd529504e7c2647609611ebc00b'
AND (
token = 'DR9TwXWfTV3fAj5mAeBoTIOXpQNAH8U6soLZWgpSi7A='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)