UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KoiRCyMC3q9JYgHm7kWqj2yH8a2Usy5t8cFbzY+KvC4='
WHERE
key_id = 'ae0e8304a0c67d64345e4ebe164a5c77f9fe10f691924cfdd1fb55ff9756e7fb'
AND (
token = 'KoiRCyMC3q9JYgHm7kWqj2yH8a2Usy5t8cFbzY+KvC4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)