UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N+JlfMRjoVofdwaU4idM4lL9wjl8I30kH5v4XSlHTtA='
WHERE
key_id = 'e8c736d438907eebb04f4a8534f5a7a33a13b4a3c5f2da056a9920b454e36d05'
AND (
token = 'N+JlfMRjoVofdwaU4idM4lL9wjl8I30kH5v4XSlHTtA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)