UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xDcFIdnF/yg0rYWU+yewRMA1GGRd20Va+buAgVqNiZc='
WHERE
key_id = 'e55f2090a6a0e8874ab58b97f586ba530d2aaa348e36b26d68fc62122a50d5ef'
AND (
token = 'xDcFIdnF/yg0rYWU+yewRMA1GGRd20Va+buAgVqNiZc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)