UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RCy2CLUgLVkhNWwEVblwmaFs7sUu/2/xf+KennzGVBU='
WHERE
key_id = 'cd58a1fed65d4638b672b6859488cfc0d626af32669b3f64d9a1210628ec4209'
AND (
token = 'RCy2CLUgLVkhNWwEVblwmaFs7sUu/2/xf+KennzGVBU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)