UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bsKRFw98EDekBZ2qeeQpietg2TniXH9Ga0dM4O5RQ98=' 
WHERE 
  key_id = '138343c359365bcf170eff9e9138ffb90a269a5e7e7fe1e06e87b3d5cb94a9d6' 
  AND (
    token = 'bsKRFw98EDekBZ2qeeQpietg2TniXH9Ga0dM4O5RQ98=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043