UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fdWF0f2nz/9pG94SOl2ySxxLJyxVQ8UXWmre4KohaG8=' 
WHERE 
  key_id = '050afda8d38aa202bb311adca3f2bf96e1b068ae142f5556a32ffa6bb5cf49b6' 
  AND (
    token = 'fdWF0f2nz/9pG94SOl2ySxxLJyxVQ8UXWmre4KohaG8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040