UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Pas+WwtU5mHRU+cL1qY0Wi3QvuW1n31FgJA4IYMQ1ug=' 
WHERE 
  key_id = '48a8771529d2af20b33492894a850bd4a497b00f443056e6df3ada167ce1a651' 
  AND (
    token = 'Pas+WwtU5mHRU+cL1qY0Wi3QvuW1n31FgJA4IYMQ1ug=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028