UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'I/iM0MUvJcyk0IFRCkBM1bSoYub+g8vS8KsmcMlgRu4=' 
WHERE 
  key_id = '0221f28349ace8fdd8cc4716c3fe57b6aa12f14af3327005f0acce15a6d3bf33' 
  AND (
    token = 'I/iM0MUvJcyk0IFRCkBM1bSoYub+g8vS8KsmcMlgRu4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037