UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'g2xSQDiG5MXKNVinZUEwb8UvGcMouGYzDGAo4Av0azU=' 
WHERE 
  key_id = '009e0bb098891a133ee6838a8da107cdecfdc6d004fa045e21b028bad706931a' 
  AND (
    token = 'g2xSQDiG5MXKNVinZUEwb8UvGcMouGYzDGAo4Av0azU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044