UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yjuaQ/IwGYkkWwWrVJPl5w4lZz5PNNjDdN+DGvvkjew='
WHERE
key_id = '4c852eb19b00fcdfe248cf4c1b30b047d36f2f2a5dc4d0d312e52605d478f8fb'
AND (
token = 'yjuaQ/IwGYkkWwWrVJPl5w4lZz5PNNjDdN+DGvvkjew='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)