UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'oAK6bhDxxpF8HSVQFX/d3F8F1aFVTA63w+MzeHIV3ig='
WHERE
key_id = '59d3fdf35b5d979dc56ce011e18cd748c2c97009102940f6d090d69cc132b1a7'
AND (
token = 'oAK6bhDxxpF8HSVQFX/d3F8F1aFVTA63w+MzeHIV3ig='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)