UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'tNAdREY0NTEKHE5z8+Oa3Q8p5AZr34s8D5uLdI8qOcc='
WHERE
key_id = '8c28f470ad88f8f45398459ffa9e2d3c54f71b88b9105ac3c8ffcdaef1683cb8'
AND (
token = 'tNAdREY0NTEKHE5z8+Oa3Q8p5AZr34s8D5uLdI8qOcc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)