UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f65orCiCI05fGQSow6dnbDCs4rmFVlDgi+45wnDGF58='
WHERE
key_id = '1fd9ec3e872a63c57e6273fd0922194a62d7bd3ed981b32071827da8e514a7a1'
AND (
token = 'f65orCiCI05fGQSow6dnbDCs4rmFVlDgi+45wnDGF58='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)