UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7UCz3n/PpWlsqMBd33HOLnE1liK32UQg19cg6Tzkgkk='
WHERE
key_id = 'bfc0b04c3844b0b6982f34c6e0d832858d9b87dfcc8ce0e0f5e2b08f791f5860'
AND (
token = '7UCz3n/PpWlsqMBd33HOLnE1liK32UQg19cg6Tzkgkk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)