UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mefR1iYhSCmkU0itOVtIpgd0RATFaKWomt+g91B2lyY=' 
WHERE 
  key_id = '66e2c46382d74b0fdad93b49d0b8dd5187df36f726a0899c64930bca81de768d' 
  AND (
    token = 'mefR1iYhSCmkU0itOVtIpgd0RATFaKWomt+g91B2lyY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039