UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '0BGq1azTWR4Stq1sZWgHxy+eRouOnU87EbUOuu2hqNM='
WHERE
key_id = 'fba0268cc9f49a3edf164909f68410d9a6867ef4504d376c2efe16708d08c404'
AND (
token = '0BGq1azTWR4Stq1sZWgHxy+eRouOnU87EbUOuu2hqNM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)