UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'bJ18g55eYQIrTWTIAGiN5J6mLWXIxKSikb+OGKVPFiI='
WHERE
key_id = '6b2ef96644d7d6df01571e57cd9c56c0afe1a39630b584eacc5c5f26e833428c'
AND (
token = 'bJ18g55eYQIrTWTIAGiN5J6mLWXIxKSikb+OGKVPFiI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)