UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'p9cZiPs85n3EAnKKsASdn8iy9qdW8Wv2dvRIz5pCjfI='
WHERE
key_id = '5f8b0242270a846dc1d1d1cf81c5d8eab8d110609842f641c3d3d31982c10134'
AND (
token = 'p9cZiPs85n3EAnKKsASdn8iy9qdW8Wv2dvRIz5pCjfI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)