UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V8dpjkkpOXhrP+aTofi9NumWlyJA4JZIWuU8/44TsHU=' 
WHERE 
  key_id = '587e9938eab3fe738a72741086f567d41e8b9c8498349f404ac4826a6c18648f' 
  AND (
    token = 'V8dpjkkpOXhrP+aTofi9NumWlyJA4JZIWuU8/44TsHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027