UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WfrylH6r12yzCj3ydULzpvqb1cJshkwOOuZ+OkpCbUc=' 
WHERE 
  key_id = '411ad0c6f3a0f0e04633d169fc5a0674a1f061364be71e45a45560b5e225d35a' 
  AND (
    token = 'WfrylH6r12yzCj3ydULzpvqb1cJshkwOOuZ+OkpCbUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027