UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KU9aCIm0bKx2IAaA72pOSyfmJZp9+Xin6BQqVi/wTkw='
WHERE
key_id = 'b946912a053e1cd75e2e61489d1587e6975bbcf876776b14dc1f1b59bd9f1949'
AND (
token = 'KU9aCIm0bKx2IAaA72pOSyfmJZp9+Xin6BQqVi/wTkw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)