UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bJFT43G3OHYGKWK4iklb5Bg4RtydkelZjZ0m+EPZgRM='
WHERE
key_id = 'faf5701584b1d33a76b4b737a76e1bf87da48222879077a549dbf27828e371da'
AND (
token = 'bJFT43G3OHYGKWK4iklb5Bg4RtydkelZjZ0m+EPZgRM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)