UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5YhU4Tv8qpwacmYG5MVp+AY2VKov3t0C+zvR2K4YAVc='
WHERE
key_id = 'adfb262e7f929ac012e40cca32516ac1df58e3154774928ce9a675d2a4da2475'
AND (
token = '5YhU4Tv8qpwacmYG5MVp+AY2VKov3t0C+zvR2K4YAVc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)